/**
 @file sys_usw_api.h

 @date 2020-3-10

 @version v5.6

*/

#ifndef _SYS_USW_API_H
#define _SYS_USW_API_H
#ifdef __cplusplus
extern "C" {
#endif
#include "sal.h"
#include "ctc_l2.h"
#include "ctc_qos.h"
#include "ctc_nexthop.h"

#define SYS_L3IF_INVALID_L3IF_ID   0
#define SYS_NH_NSH_UPDATE_ID        0xFFFF
#define SYS_NH_NSH_REMOVE_ID        0xFFFE

/* Define sys stats type */
enum sys_stats_type_e
{
    SYS_STATS_TYPE_QUEUE,
    SYS_STATS_TYPE_QUEUE_MC,
    SYS_STATS_TYPE_DMA,
    SYS_STATS_TYPE_DMA_MC,
    SYS_STATS_TYPE_PORTTC,
    SYS_STATS_TYPE_PORTTC_MC,
    SYS_STATS_TYPE_VLAN,
    SYS_STATS_TYPE_INTF,
    SYS_STATS_TYPE_VRF,
    SYS_STATS_TYPE_SCL,
    SYS_STATS_TYPE_TUNNEL,
    SYS_STATS_TYPE_LSP,
    SYS_STATS_TYPE_PW,
    SYS_STATS_TYPE_ACL,
    SYS_STATS_TYPE_FWD_NH,
    SYS_STATS_TYPE_FIB,
    SYS_STATS_TYPE_POLICER0,
    SYS_STATS_TYPE_POLICER1,
    SYS_STATS_TYPE_ECMP,
    SYS_STATS_TYPE_HECMP,
    SYS_STATS_TYPE_PORT,
    SYS_STATS_TYPE_FLOW_HASH,
    SYS_STATS_TYPE_MAC,
    SYS_STATS_TYPE_NSH,
    SYS_STATS_TYPE_FID,
    SYS_STATS_TYPE_SDC,
    SYS_STATS_TYPE_NPM_IM,
    SYS_STATS_TYPE_MAX
};
typedef enum sys_stats_type_e sys_stats_type_t;

enum sys_qos_policer_type_e
{
    SYS_QOS_POLICER_TYPE_PORT,
    SYS_QOS_POLICER_TYPE_VLAN,
    SYS_QOS_POLICER_TYPE_FLOW,
    SYS_QOS_POLICER_TYPE_MACRO_FLOW,
    SYS_QOS_POLICER_TYPE_SERVICE,
    SYS_QOS_POLICER_TYPE_COPP,
    SYS_QOS_POLICER_TYPE_MFP,
    SYS_QOS_POLICER_TYPE_SVC,
    SYS_QOS_POLICER_TYPE_CHAN,
    SYS_QOS_POLICER_TYPE_GROUP_FLOW,
    SYS_QOS_POLICER_TYPE_MAX
};
typedef enum sys_qos_policer_type_e  sys_qos_policer_type_t;

struct sys_nh_nsh_edit_info_s
{
    uint16 bus_offset;
};
typedef struct sys_nh_nsh_edit_info_s sys_nh_nsh_edit_info_t;

struct sys_qos_policer_group_info_s
{
    uint8  dir;
    uint8  is_bind;
    uint16 policer_id;
    uint16 policer_id_bind;
    uint16 policer_group_ptr;
    uint16 policer_member_ptr;
};
typedef struct sys_qos_policer_group_info_s sys_qos_policer_group_info_t;

struct sys_qos_policer_param_s
{
    uint16 policer_id;       /*in*/
    uint8  dir;              /*in*/
    uint8  glb_policer;      /*in*/
    uint8  sys_policer_type; /*in*/
    uint8  internal_use;     /*in*/

    uint8  level;            /*out*/
    uint8  is_bwp;           /*out*/
    uint16 policer_ptr;      /*out*/
};
typedef struct sys_qos_policer_param_s sys_qos_policer_param_t;

#define SYS_MAX_QUEUE_OFFSET_PER_NETWORK_CHANNEL  12
#define SYS_MAX_QUEUE_OFFSET_PER_EXT_GROUP  4
#define SYS_MAX_QOS_UC_DROP_PRECEDENCE_LEVEL 4
#define SYS_MAX_QOS_MC_DROP_PRECEDENCE_LEVEL 8
struct sys_qos_shape_profile_s
{
    uint8  chan_shp_tokenThrd;
    uint8  chan_shp_tokenThrdShift;
    uint8  ext_grp_shp_profileId;
    uint8  rsv;
    uint8  queue_shp_profileId[SYS_MAX_QUEUE_OFFSET_PER_NETWORK_CHANNEL];
    uint8  ext_queue_shp_profileId[SYS_MAX_QUEUE_OFFSET_PER_EXT_GROUP];
};
typedef struct sys_qos_shape_profile_s sys_qos_shape_profile_t;

struct sys_cpu_reason_info_s
{
    uint16 reason_id;
    uint8  dsnh_8w;
    uint8  fatal_excp_valid;
    uint16 fatal_excp_index;
    uint8  exception_index;
    uint8  exception_subIndex;
    uint16 gid_for_acl_key;
    uint8  gid_valid;
    uint8  acl_key_valid;
    uint32 nexthop_ptr;
};
typedef struct sys_cpu_reason_info_s sys_cpu_reason_info_t;

struct sys_cpu_reason_dest_info_s
{

    uint32 dest_port;
    uint32 dest_map;
    uint32 nexthop_ptr;
    uint32 nexthop_id;
    uint16 sub_queue_id;
    uint8 dest_type;
    uint8 sub_idx;
    uint8 raw_dest_en;
    uint8 dsnh_8w;
    uint8 slice_bmp;
    uint8 user_define_mode;
    uint8 excp_num;
    uint16 excp_array[32];
};
typedef struct sys_cpu_reason_dest_info_s sys_cpu_reason_dest_info_t;

enum sys_api_nh_entry_type_e
{
    SYS_API_NH_DSFWD,
    SYS_API_NH_DSFWD_HALF,
    SYS_API_NH_DSMET,
    SYS_API_NH_DSMET_RSVED,               /*for keep alive member and mcast profile*/
    SYS_API_NH_NEXTHOP_4W,
    SYS_API_NH_L2EDIT,
    SYS_API_NH_L3EDIT,
    SYS_API_NH_L3EDIT_SPME,
    SYS_API_NH_L2EDIT_OUTER_4W,
    SYS_API_NH_LOGIC_DEST_PORT,
    SYS_API_NH_DSFWD1,/*AT*/
    SYS_API_NH_DSFWD_HALF1,/*AT*/
    SYS_API_NH_L2EDIT_INNER,/*AT*/
    SYS_API_NH_L3EDIT_INNER,/*AT*/
    SYS_API_NH_NUM
};
typedef enum sys_api_nh_entry_type_e sys_api_nh_entry_type_t;


enum sys_usw_nh_type_e
{
    SYS_NH_TYPE_NULL,
    SYS_NH_TYPE_MCAST,
    SYS_NH_TYPE_BRGUC,
    SYS_NH_TYPE_IPUC,
    SYS_NH_TYPE_MPLS,
    SYS_NH_TYPE_ECMP, /*For IPUC, MPLS, etc*/
    SYS_NH_TYPE_DROP,
    SYS_NH_TYPE_TOCPU,
    SYS_NH_TYPE_UNROV,
    SYS_NH_TYPE_ILOOP,
    SYS_NH_TYPE_ELOOP,
    SYS_NH_TYPE_RSPAN,
    SYS_NH_TYPE_IP_TUNNEL, /*Added by IP Tunnel*/
    SYS_NH_TYPE_TRILL,
    SYS_NH_TYPE_MISC,
    SYS_NH_TYPE_WLAN_TUNNEL,
    SYS_NH_TYPE_SRV6,
    SYS_NH_TYPE_OVERLAY_VNI,
    SYS_NH_TYPE_OVERLAY,
    SYS_NH_TYPE_APS,
    SYS_NH_TYPE_MAX
};
typedef enum sys_usw_nh_type_e sys_usw_nh_type_t;

struct sys_nh_update_dsnh_param_s
{

    void*     data;
    int32 (* updateAd) (uint8 lchip, void* data, void* change_nh_param);
    uint32 chk_data;
    uint8  bind_feature;  /*refer to struct ctc_feature_t*/
};
typedef struct sys_nh_update_dsnh_param_s sys_nh_update_dsnh_param_t;

struct sys_nh_update_dsfwd_s
{
    uint32 dsfwd_offset;
    uint32 dsfwd1_offset;
    uint32 dsnh_offset;
    uint32 dest_map         : 20,
           dsnh_8w          : 8,
           del              : 1,
           critical_packet  : 1,
           is_dsfwd1        : 1,
           rsv              : 1;
};
typedef struct sys_nh_update_dsfwd_s sys_nh_update_dsfwd_t;

struct sys_nh_info_dsnh_s
{
    uint32   nhid;
    uint8    nh_entry_type; /*nexthop type*/
    uint32   dsnh_offset;
    uint32   dsfwd_offset;
    uint32   dsfwd1_offset;
    uint8    nexthop_ext;
    uint8    adjust_len;
    uint8    is_mcast;
    uint8    drop_pkt;
    uint32   gport;       /*ucast output port, for mcast means mcast group ID */
    uint32   dest_map;
    uint32 nh_entry_flags;

    uint8    dsfwd_valid:1;
    uint8    dsfwd1_valid:1;
    uint8    aps_en:1;      /*if enable, destid is aps group id*/
    uint8    is_ivi:1;      /*sub type is ivi of ip-tunnel*/
    uint8    stats_en:1;
    uint8    to_cpu_en:1;   /*for arp miss to cpu*/
    uint8    swap_mac:1;
    uint8    rsv1:1;

    uint8    merge_dsfwd; /*0:may need dsfwd; 1.don't dsfwd;2.must need dsfwd */

    /*ecmp info*/
    uint8    ecmp_valid;
    uint8    is_ecmp_intf;
    uint16   ecmp_group_id;
    uint8    ecmp_num;
    uint8    valid_cnt;   /*valid ecmp member*/
    uint8    ecmp_cnt;    /*include valid & unresoved ecmp member*/
    uint32  *nh_array; /*valid nh array[valid_cnt] -->unresoved nh*/

    uint8    protection_path;   /*[input]get protect path nexthop info*/
    uint8    mep_on_tunnel;	    /*[output]mep on tunnel label*/
    uint16   oam_aps_group_id;  /*if mep on PW label,oam_aps_group_id is tunnel aps group id;
                                  if mep on tunnel label, oam_aps_group_id is tunnel group id */
    uint16   oam_aps_en;
    uint8    have_l2edit;
    uint8    cloud_sec_en;

    /* ip-tunnel info */
    uint8   re_route;
    uint8   use_destmap_profile;
    uint32  arp_id;
    uint32 w_nh_id;

    uint8 individual_nexthop;/*if set, means two dsnexthop for aps*/
    uint8 bypass_igr_edit;
    uint32 tunnel_id;
    uint32 l3_edit_ptr;
    uint32 pair_edit_ptr;
    uint16 logic_port;
    uint16 ldp_ext;

    /* Merge Dsfwd update*/
    void* data;   /*used for merge dsfwd update*/
    int32 (* updateAd) (uint8 lchip, void* data, void* change_nh_param);
    uint32  chk_data;
    uint8   need_lock;
    uint8   bind_feature;   /*refer to struct ctc_feature_t*/
	uint8   bind_lchip;

    uint8  oam_nh       : 1;    /*[input]used for oam get nh dsnh*/
    uint8  replace_mode : 1;    /*only used for ipuc nexthop*/
    uint8  h_ecmp_en    : 1;
    uint8  pw_aps_en    : 1;    /*mpls nexthop pw level have aps */
    uint8 logic_rep_list: 1;
    uint8  bind_ldp     : 1;
    uint8  fp2          : 1;
    uint8  rsv          : 1;
    uint16 logic_rep_num;

    uint16  rpf_profile_id;
};
typedef struct sys_nh_info_dsnh_s sys_nh_info_dsnh_t;

struct sys_nh_update_dsnh_node_s
{
    ctc_slistnode_t node;
    sys_nh_info_dsnh_t dsnh_info;
};
typedef struct sys_nh_update_dsnh_node_s sys_nh_update_dsnh_node_t;
enum sys_usw_nh_res_offset_type_e
{
    SYS_NH_RES_OFFSET_TYPE_NONE = 0,

    SYS_NH_RES_OFFSET_TYPE_BRIDGE_NH = SYS_NH_RES_OFFSET_TYPE_NONE,  /*port tagged mode*/
    SYS_NH_RES_OFFSET_TYPE_BYPASS_NH,
    SYS_NH_RES_OFFSET_TYPE_MIRROR_NH,
    SYS_NH_RES_OFFSET_TYPE_BPE_TRANSPARENT_NH,
    SYS_NH_RES_OFFSET_TYPE_OL_BRIDGE_NH,
    SYS_NH_RES_OFFSET_TYPE_STK_IGS_EDIT_BRG,
    SYS_NH_RES_OFFSET_TYPE_TWAMP_CHKSUM_NH,

    SYS_NH_RES_OFFSET_TYPE_MAX
};
typedef enum sys_usw_nh_res_offset_type_e sys_usw_nh_res_offset_type_t;

typedef int32 (* SYS_ACL_CHANGE_STATS_PTR_CB)(uint8 lchip, uint32 new_stats_ptr, uint8 new_ram, void* user_data);

struct sys_stats_acl_change_s
{
    uint32 stats_id;
    uint8  new_block_id;
    SYS_ACL_CHANGE_STATS_PTR_CB cb;
    void* user_data;
};
typedef struct sys_stats_acl_change_s sys_stats_acl_change_t;

struct sys_stats_flow_stats_s
{
    uint32 stats_ptr       :24,/*low 16 bit indicate local hw statsptr, others indicate stats ram , refer to sys_stats_ram_t, used to map ram-id each other*/
           /*flag            :2,*/
           rsv0            :8;
    uint32 stats_id;
    uint64 packet_count    :56;
    uint64 rsv1            :8;
    uint64 byte_count;
};
typedef struct sys_stats_flow_stats_s sys_stats_flow_stats_t;

struct sys_stats_statsid_s
{
    uint32 stats_id;
    uint32 stats_ptr        :24;
    uint32 stats_id_type    :6;
    uint32 dir              :1;
    uint32 stats_ptr_valid  :1;
};
typedef struct sys_stats_statsid_s sys_stats_statsid_t;

struct sys_stats_statsid_acl_s
{
    sys_stats_statsid_t common;/* keep top*/
    uint32 color_aware      :1;
    uint32 acl_priority     :7;
    uint32 rsv              :24;
};
typedef struct sys_stats_statsid_acl_s sys_stats_statsid_acl_t;

struct sys_stats_statsid_npm_im_s
{
    sys_stats_statsid_t common;/* keep top*/
    uint32 egs_stats_ptr_valid     :1;
    uint32 egs_stats_ptr           :24;
    uint32 rsv                     :7;
};
typedef struct sys_stats_statsid_npm_im_s sys_stats_statsid_npm_im_t;

#define SYS_STATS_FLAG_NPM_OP       (1<<0)
#define SYS_STATS_FLAG_NPM_LOSS     (1<<1)
#define SYS_STATS_FLAG_ACL_STABLE   (1<<2)

struct sys_stats_param_s
{
    uint32 id;

    uint8  flag;
    uint8  ram_id;
    uint8  type;
    uint8  dir;
    uint8  acl_pri;/* for acl or scl priority */
    uint16 num;
    uint32 ptr;
};
typedef struct sys_stats_param_s sys_stats_param_t;

struct sys_l3if_brief_info_s
{
    uint8   l3if_type;
    uint8   bind_en;
    uint32  gport;
    uint16  vlan_id;
    uint16  cvlan_id;
    uint16  l3if_id;
    uint8   vaild;
};
typedef struct sys_l3if_brief_info_s  sys_l3if_brief_info_t;

enum sys_aging_domain_type_e
{
    SYS_AGING_DOMAIN_TCAM,
    SYS_AGING_DOMAIN_NAT_TCAM,
    SYS_AGING_DOMAIN_MAC_HASH,
    SYS_AGING_DOMAIN_FLOW_HASH,
    SYS_AGING_DOMAIN_IP_HASH,
    SYS_AGING_DOMAIN_HOST1,
    SYS_AGING_DOMAIN_LPM_HASH_GROUP0,
    SYS_AGING_DOMAIN_LPM_HASH_GROUP1,
    SYS_AGING_DOMAIN_NUM
};
typedef enum sys_aging_domain_type_e sys_aging_domain_type_t;

enum sys_xdata_func_e
{
    SYS_XDATA_FUNC_LOGIC_PORT_EXT  = 0,
    SYS_XDATA_FUNC_NAT,
    SYS_XDATA_FUNC_FWD_TYPE,
    SYS_XDATA_FUNC_ECMP_HASH_H,
    SYS_XDATA_FUNC_IP_IOAM,
    SYS_XDATA_FUNC_NSH,
    SYS_XDATA_FUNC_MAX,
};
typedef enum sys_xdata_func_e sys_xdata_func_t;

struct sys_ldp_s
{
    uint32  l3edit_ptr;
    uint32  l2edit_ptr;
    uint16  lp_grp_id;
    uint16  isolation_id;
    uint8   scl0_hash_type;
    uint8   scl1_hash_type;
    uint16  dest_vlan_ptr;
    uint8   edit_mode;
    uint32 xedit_ptr;
	uint32 stats_ptr;

    uint8 acl_use_outer_valid:1;/*AT...*/
    uint8 acl_use_outer:1;/*AT...*/
    uint8 acl_merge_valid:1;/*AT...*/
    uint8 acl_merge:1;/*AT...*/
    uint8 ipfix_use_outer_valid:1;/*AT...*/
    uint8 ipfix_use_outer:1;/*AT...*/
    uint8 nsh_en:1;/*AT...*/
    uint8 rsv:1;

    uint8 esid;
};
typedef struct sys_ldp_s  sys_ldp_t;

struct sys_port_chan_map_param_s
{
    uint16 lport;
    uint16 channel_id;
    uint8  is_pp;
};
typedef struct sys_port_chan_map_param_s sys_port_chan_map_param_t;

#define ______SYS_L3IF_API______
extern int32
sys_usw_l3if_binding_inner_router_mac(uint8 lchip, mac_addr_t* p_mac_addr, uint16* route_mac_index);

extern int32
sys_usw_l3if_get_l3if_brief_info(uint8 lchip, sys_l3if_brief_info_t* l3if_info);

extern bool
sys_usw_l3if_is_port_phy_if(uint8 lchip, uint32 gport);

extern bool
sys_usw_l3if_is_port_sub_if(uint8 lchip, uint32 gport, uint8* double_vlan);

extern int32
sys_usw_l3if_set_acl_league_property(uint8 lchip, uint8 acl_pri, uint8 enable, uint8 sub_blk_cnt, uint8 *sub_blk_list);
extern int32
sys_usw_l3if_unbinding_inner_router_mac(uint8 lchip, uint16 route_mac_index);
extern int32
sys_usw_l3if_get_inner_router_mac(uint8 lchip, uint16 route_mac_index, mac_addr_t* mac);
#if 0
extern int32
sys_usw_l3if_wb_restore_sub_if(uint8 lchip);
#endif

#define ______SYS_QOS_API______
extern int32
sys_usw_set_dma_channel_drop_en(uint8 lchip, bool enable);
extern int32
sys_usw_get_sub_queue_id_by_cpu_reason(uint8 lchip, uint16 reason_id, uint16* sub_queue_id);
extern int32
sys_usw_qos_add_mcast_queue_to_channel(uint8 lchip, uint16 lport, uint8 channel);
extern int32
sys_usw_qos_bind_service_logic_srcport(uint8 lchip, uint16 service_id, uint16 logic_port);
extern int32
sys_usw_qos_fcdl_state_isr(uint8 lchip, uint16 mac_id);
extern int32
sys_usw_qos_policer_group_bind(uint8 lchip,sys_qos_policer_group_info_t* p_policer_group_info);
extern int32
sys_usw_qos_policer_group_check_bind(uint8 lchip,sys_qos_policer_group_info_t* p_policer_group_info);
extern int32
sys_usw_qos_policer_group_unbind(uint8 lchip,sys_qos_policer_group_info_t* p_policer_group_info);
extern int32
sys_usw_qos_policer_index_get(uint8 lchip, sys_qos_policer_param_t* p_policer_param);
extern int32
sys_usw_qos_policer_id_get(uint8 lchip, sys_qos_policer_param_t* p_policer_param, uint16* policer_id);

extern int32
sys_usw_qos_remove_mcast_queue_to_channel(uint8 lchip, uint16 lport, uint8 channel);
extern int32
sys_usw_qos_unbind_service_logic_srcport(uint8 lchip, uint16 service_id, uint16 logic_port);
extern int32
sys_usw_queue_get_port_depth(uint8 lchip, uint32 gport, uint32* p_depth);
extern int32
sys_usw_queue_get_profile_from_hw(uint8 lchip, uint32 gport, sys_qos_shape_profile_t* p_shp_profile);
extern int32
sys_usw_queue_get_service_queue_mode(uint8 lchip, uint8 *service_queue_mode);
extern int32
sys_usw_queue_set_port_drop_en(uint8 lchip, uint32 gport, bool enable, void* p_drop_param);
extern int32
sys_usw_qos_set_global_config(uint8 lchip, ctc_qos_glb_cfg_t* p_glb_cfg);
extern int32
sys_usw_qos_set_policer(uint8 lchip, ctc_qos_policer_t* p_policer);
extern int32
sys_usw_qos_set_queue(uint8 lchip, ctc_qos_queue_cfg_t* p_que_cfg);
extern int32
sys_usw_remove_port_from_channel(uint8 lchip, uint16 lport, uint16 channel);
extern int32
sys_usw_qos_flow_ctl_profile(uint8 lchip, uint32 gport, uint8 cos, uint8 is_pfc, uint8 is_oobfc, uint8 enable);

#define ______SYS_VLAN_API______
extern int32
sys_usw_vlan_class_set_default_action(uint8 lchip, uint16 lport, uint8 scl_id, uint8 is_add);
extern int32
sys_usw_vlan_get_maxvid_from_vrange(uint8 lchip, ctc_vlan_range_info_t* vrange_info, ctc_vlan_range_t* vlan_range, bool is_svlan, uint16* p_max_vid);
extern int32
sys_usw_vlan_get_vlan_range_type(uint8 lchip, ctc_vlan_range_info_t* vrange_info, bool* is_svlan);
extern int32
sys_usw_vlan_overlay_get_fid(uint8 lchip,  uint32 vn_id, uint16* p_fid );
extern int32
sys_usw_vlan_set_acl_league_property(uint8 lchip, uint8 acl_pri, uint8 enable, uint8 sub_blk_cnt, uint8 *sub_blk_list);
extern int32
sys_usw_add_port_to_channel(uint8 lchip, uint16 lport, uint16 channel, uint8 is_pp);

#define ______SYS_FDB_API______
extern int32
sys_usw_l2_set_station_move(uint8 lchip, uint32 gport, uint8 type, uint32 logic_port, uint8 enable, uint32 value);
extern int32
sys_usw_aging_set_aging_interval(uint8 lchip, uint8 timer_idx, uint32 age_seconds);
extern int32
sys_usw_l2_fdb_get_search_depth(uint8 lchip, uint32* p_search_depth);
extern int32
sys_usw_l2_fdb_set_search_depth(uint8 lchip, uint32 search_depth);
extern int32
sys_usw_l2_flush_fdb(uint8 lchip, ctc_l2_flush_fdb_t* pf);
extern int32
sys_usw_l2_get_ucast_nh(uint8 lchip, uint32 gport, ctc_nh_param_brguc_sub_type_t nh_type, uint32* nhid);

#define ______SYS_PACKET_API______
extern int32
sys_usw_packet_set_cpu_mac(uint8 lchip, uint8 idx, uint32 gport, mac_addr_t da, mac_addr_t sa, uint16 vlan_id, uint16 tpid);

#define ______SYS_CPU_REASON_API______
extern int32
sys_usw_cpu_reason_alloc_exception_index(uint8 lchip, uint8 dir, sys_cpu_reason_info_t* p_cpu_rason_info);
extern int32
sys_usw_cpu_reason_free_exception_index(uint8 lchip, uint8 dir, sys_cpu_reason_info_t* p_cpu_rason_info);
extern int32
sys_usw_cpu_reason_get_reason_info(uint8 lchip, uint8 dir, sys_cpu_reason_info_t* p_cpu_rason_info);
#define ______SYS_NH_API______
extern int32
sys_usw_nh_add_misc(uint8 lchip, uint32* nhid, ctc_misc_nh_param_t* p_nh_param, bool is_internal_nh);
extern int32
sys_usw_nh_check_glb_met_offset(uint8 lchip, uint32 start_offset, uint32 entry_num,
                                      bool should_not_inuse);
extern int32
sys_usw_nh_get_aps_working_path(uint8 lchip, uint32 nhid, uint32* gport, uint32* nexthop_ptr, bool* p_protect_en);
extern int32
sys_usw_nh_get_dsfwd_offset(uint8 lchip, uint32 nhid, uint32 *p_dsfwd_offset, uint8 in_cb, uint8 feature);
extern int32
sys_usw_nh_get_dsfwd1_offset(uint8 lchip, uint32 nhid, uint32 *p_dsfwd_offset, uint8 in_cb, uint8 feature);
extern int32
sys_usw_nh_get_fatal_excp_dsnh_offset(uint8 lchip, uint32* p_offset);
extern int32
sys_usw_nh_get_max_hecmp(uint8 lchip, uint32* max_ecmp);
extern int32
sys_usw_nh_get_nhinfo(uint8 lchip, uint32 nhid, sys_nh_info_dsnh_t* p_nhinfo, uint8 in_cb);
extern int32
sys_usw_nh_set_ts_edit_en(uint8 lchip, uint32 nhid, uint8 ts_edit_en);
extern int32
sys_usw_nh_get_reflective_dsfwd_offset(uint8 lchip, uint32* p_dsfwd_offset);
extern char*
sys_usw_reason_2Str(uint16 reason_id);
extern int32
sys_usw_brguc_nh_create(uint8 lchip, uint32 gport, ctc_nh_param_brguc_sub_type_t nh_type);
extern int32
sys_usw_brguc_nh_delete(uint8 lchip, uint32 gport);
extern int32
sys_usw_l2_get_station_move(uint8 lchip, uint32 gport, uint8 type, uint32* value);
extern int32
sys_usw_nh_alloc(uint8 lchip, sys_api_nh_entry_type_t entry_type, uint32 entry_num, uint32* p_offset);
extern int32
sys_usw_nh_free(uint8 lchip, sys_api_nh_entry_type_t type, uint32 entry_num, uint32 offset);
extern int32
sys_usw_nh_alloc_from_position(uint8 lchip, sys_api_nh_entry_type_t entry_type, uint32 entry_num, uint32 offset);
extern int32
sys_usw_nh_bind_dsfwd_cb(uint8 lchip, uint32 nhid, sys_nh_update_dsnh_param_t* p_update_dsnh);
extern int32
sys_usw_nh_get_mcast_nh(uint8 lchip, uint32 group_id, uint32* nhid);
extern int32
sys_usw_nh_set_mcast_ppbmp(uint8 lchip, uint32 group_id, uint32 set_flag);
extern int32
sys_usw_nh_get_nh_resource(uint8 lchip, sys_api_nh_entry_type_t type, uint32* used_count);
extern int32
sys_usw_nh_get_resolved_offset(uint8 lchip, sys_usw_nh_res_offset_type_t type, uint32* p_offset);
extern int32
sys_usw_nh_get_rsv_iloop(uint8 lchip, uint8 dp_id, uint32* nhid);
extern bool
sys_usw_nh_is_ipmc_logic_rep_enable(uint8 lchip);
extern int32
sys_usw_nh_remove_misc(uint8 lchip, uint32 nhid);
extern int32
sys_usw_nh_set_ipmc_logic_replication(uint8 lchip, uint8 enable);
extern int32
sys_usw_nh_set_max_hecmp(uint8 lchip, uint32 max_num);
extern int32
sys_usw_nh_update_dsfwd(uint8 lchip, sys_nh_update_dsfwd_t* p_update_param);

extern int32
sys_usw_nh_add_l3edit_natsa(uint8 lchip, uint32* ipsa, uint16 src_port, uint32* p_offset, uint8 double_nat, uint8 is_ipv6, uint8 masklen);
extern int32
sys_usw_nh_remove_l3edit_natsa(uint8 lchip, uint32* ipsa, uint16 src_port, uint32 offset, uint8 double_nat, uint8 is_ipv6, uint8 masklen);


extern int32
sys_usw_nh_get_l3ifid(uint8 lchip, uint32 nhid, uint16* p_l3ifid);

extern int32
sys_usw_nh_is_unrov(uint8 lchip, uint32 nhid, uint8* val);
extern int32
sys_usw_nh_get_bind_ldp_en(uint8 lchip, uint8* enable);

extern int32
sys_usw_nh_get_nsh_edit_info(uint8 lchip, uint16 nsh_id, sys_nh_nsh_edit_info_t* p_edit);

extern int32
sys_usw_nh_set_logic_port_type(uint8 lchip, uint32 logic_port, void* p_value, uint8 in_cb);

extern int32
sys_usw_nh_get_logic_port_type(uint8 lchip, uint32 logic_port, void* p_value, uint8 in_cb);

#define ______SYS_STATS_API______
extern int32
sys_usw_flow_stats_alloc_statsptr(uint8 lchip, sys_stats_param_t* p_sts);
extern int32
sys_usw_flow_stats_free_statsptr(uint8 lchip, sys_stats_param_t* p_sts);
extern int32
sys_usw_flow_stats_change_acl_statsptr(uint8 lchip, sys_stats_acl_change_t* p_acl_change);
extern int32
sys_tmm_flow_stats_get_acl_stats_ram_id(uint8 lchip, uint32 stats_ptr, uint8 dir, uint8* hw_ram_idx, uint32* P_cache_ptr);
extern  int32
sys_usw_flow_stats_32k_ram_init(uint8 lchip);
extern int32
sys_usw_flow_stats_get_statsid(uint8 lchip, sys_stats_statsid_t* p_statsid);
extern int32
sys_usw_flow_stats_get_statsptr(uint8 lchip, uint32 stats_id, uint32* p_cache_ptr);
extern int32
sys_usw_flow_stats_update_ecmp_stats(uint8 lchip, uint32 new_num, uint32 old_num, uint8 hecmp_en);
extern int32
sys_usw_flow_stats_lookup_statsid(uint8 lchip, ctc_stats_statsid_type_t type, uint32 cache_ptr, uint32 * p_statsid, uint8 dir);

extern void
sys_usw_mac_stats_get_port_rate(uint8 lchip, uint32 gport, uint64* p_throughput);

#define ______SYS_SECURITY_API______
extern int32
sys_usw_ip_source_guard_add_default_entry(uint8 lchip, uint32 gport, uint8 scl_id);
extern int32
sys_usw_ip_source_guard_remove_default_entry(uint8 lchip, uint32 gport, uint8 scl_id);

#define ______SYS_LEARNING_AGING_API______
extern int32
sys_usw_aging_get_aging_timer(uint8 lchip, uint8 domain_type, uint32 key_index, uint8* p_timer);
extern int32
sys_usw_aging_set_aging_status(uint8 lchip, sys_aging_domain_type_t domain_type, uint32 key_index, uint8 timer, uint8 status);

extern int32
_sys_usw_aging_get_host1_aging_ptr(uint8 lchip, uint32 key_index, uint32* aging_ptr);

extern int32
sys_usw_aging_get_aging_ptr(uint8 lchip, uint8 domain_type, uint32 key_index, uint32* aging_ptr);

extern int32
sys_usw_aging_get_aging_status(uint8 lchip, sys_aging_domain_type_t domain_type, uint32 key_index, uint8* hit);

#define ______SYS_APS_API______
extern
int32 sys_usw_aps_ftm_cb(uint8 lchip, uint32 *entry_num);

extern int32
sys_usw_inband_init(uint8 lchip);

extern int32
sys_usw_inband_deinit(uint8 lchip);

extern int32
sys_usw_get_channel_by_port(uint8 lchip, uint32 gport, uint16 *channel);

#ifdef __cplusplus
}
#endif

#endif
